<div class="problemindexholder" problemindex="A">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     A. Karen and Game
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     512 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     On the way to school, Karen became fixated on the puzzle game on her phone!
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/13/27/1327478902a073d7774242480818f1d4d93d7270.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     The game is played as follows. In each level, you have a grid with
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     rows and
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     columns. Each cell originally contains the number
     <span class="tex-span">
      0
     </span>
     .
    </p>
    <p>
     One move consists of choosing one row or column, and adding
     <span class="tex-span">
      1
     </span>
     to all of the cells in that row or column.
    </p>
    <p>
     To win the level, after all the moves, the number in the cell at the
     <span class="tex-span">
      <i>
       i
      </i>
     </span>
     -th row and
     <span class="tex-span">
      <i>
       j
      </i>
     </span>
     -th column should be equal to
     <span class="tex-span">
      <i>
       g
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
       ,
       <i>
        j
       </i>
      </sub>
     </span>
     .
    </p>
    <p>
     Karen is stuck on one level, and wants to know a way to beat this level using the minimum number of moves. Please, help her with this task!
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first line of input contains two integers,
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       n
      </i>
      ,
      <i>
       m
      </i>
      ≤ 100
     </span>
     ), the number of rows and the number of columns in the grid, respectively.
    </p>
    <p>
     The next
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     lines each contain
     <span class="tex-span">
      <i>
       m
      </i>
     </span>
     integers. In particular, the
     <span class="tex-span">
      <i>
       j
      </i>
     </span>
     -th integer in the
     <span class="tex-span">
      <i>
       i
      </i>
     </span>
     -th of these rows contains
     <span class="tex-span">
      <i>
       g
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
       ,
       <i>
        j
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      0 ≤
      <i>
       g
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
       ,
       <i>
        j
       </i>
      </sub>
      ≤ 500
     </span>
     ).
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     If there is an error and it is actually not possible to beat the level, output a single integer
     <span class="tex-font-style-tt">
      -1
     </span>
     .
    </p>
    <p>
     Otherwise, on the first line, output a single integer
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     , the minimum number of moves necessary to beat the level.
    </p>
    <p>
     The next
     <span class="tex-span">
      <i>
       k
      </i>
     </span>
     lines should each contain one of the following, describing the moves in the order they must be done:
    </p>
    <ul>
     <li>
      <span class="tex-font-style-tt">
       row
      </span>
      <span class="tex-span">
       <i>
        x
       </i>
      </span>
      , (
      <span class="tex-span">
       1 ≤
       <i>
        x
       </i>
       ≤
       <i>
        n
       </i>
      </span>
      ) describing a move of the form "choose the
      <span class="tex-span">
       <i>
        x
       </i>
      </span>
      -th row".
     </li>
     <li>
      <span class="tex-font-style-tt">
       col
      </span>
      <span class="tex-span">
       <i>
        x
       </i>
      </span>
      , (
      <span class="tex-span">
       1 ≤
       <i>
        x
       </i>
       ≤
       <i>
        m
       </i>
      </span>
      ) describing a move of the form "choose the
      <span class="tex-span">
       <i>
        x
       </i>
      </span>
      -th column".
     </li>
    </ul>
    <p>
     If there are multiple optimal solutions, output any one of them.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3 5<br/>2 2 2 3 2<br/>0 0 0 1 0<br/>1 1 1 2 1<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>4<br/>row 1<br/>row 1<br/>col 4<br/>row 3<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3 3<br/>0 0 0<br/>0 1 0<br/>0 0 0<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>-1<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>3 3<br/>1 1 1<br/>1 1 1<br/>1 1 1<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>3<br/>row 1<br/>row 2<br/>row 3<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In the first test case, Karen has a grid with
     <span class="tex-span">
      3
     </span>
     rows and
     <span class="tex-span">
      5
     </span>
     columns. She can perform the following
     <span class="tex-span">
      4
     </span>
     moves to beat the level:
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/dd/0f/dd0fcb1e5b1fe4c79e563210a46087f050e31b23.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     In the second test case, Karen has a grid with
     <span class="tex-span">
      3
     </span>
     rows and
     <span class="tex-span">
      3
     </span>
     columns. It is clear that it is impossible to beat the level; performing any move will create three
     <span class="tex-span">
      1
     </span>
     s on the grid, but it is required to only have one
     <span class="tex-span">
      1
     </span>
     in the center.
    </p>
    <p>
     In the third test case, Karen has a grid with
     <span class="tex-span">
      3
     </span>
     rows and
     <span class="tex-span">
      3
     </span>
     columns. She can perform the following
     <span class="tex-span">
      3
     </span>
     moves to beat the level:
    </p>
    <center>
     <img class="tex-graphics" src="/predownloaded/e5/66/e56682602939194f6486566eb2bf1a2c106dca6b.png" style="max-width: 100.0%;max-height: 100.0%;"/>
    </center>
    <p>
     Note that this is not the only solution; another solution, among others, is
     <span class="tex-font-style-tt">
      col 1
     </span>
     ,
     <span class="tex-font-style-tt">
      col 2
     </span>
     ,
     <span class="tex-font-style-tt">
      col 3
     </span>
     .
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
